// 统一管理项目中所有接口路径
import instance from "./request";
import qs from "qs";

// 精品推荐
export const JingpinAPI = () => instance.get("/products/recommend");
// 热门兑换
export const RemenAPI = () => instance.get("/products/hot");
// export function JingpinAPI(){
//     return instance.get("/products/recommend")
// }

// 获取短信验证码的请求
export const SendSMSAPI = (params) =>
  instance.post("/sendSMS", qs.stringify(params));

// 手机号验证码登录请求
export const PhoneLoginAPI = (params) =>
  instance.post("/phoneRegin", qs.stringify(params));

// 微信扫码登录
export const WeixinLoginAPI = (params) =>
  instance.post("/wechatUsers/PCLogin", qs.stringify(params));

// 手机绑定微信的请求
export const BindPhoneAPI = (params) => instance.post("/wechatUsers/binding", qs.stringify(params));

// 获取用户信息
export const GetUserInfoAPI = () => instance.get("/shop/userProfiles");


// 获取详情页数据
export const GoodDetailsAPI = id => instance.get(`/products/${id}`);


// 加入购物车请求
export const AddToCartAPI = (params) =>instance.post("/shop/carts/add", qs.stringify(params));

// 商品列表请求  get请求，带参数的写法
export const GetListAPI = (params) => instance.get("/products",{params});
// ...

// import qs from "qs"
// let obj = { name :"Vue",age:8}
// JSON.stringify(obj) // '{name :"Vue"}'
// console.log("qs.stringify(obj)为：",qs.stringify(obj)); // name=Vue&age=8
